<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<script>

description("This tests the constructor for the MediaEncryptedEvent DOM class.");

// No initializer passed.
shouldBe("new MediaEncryptedEvent('eventType').bubbles", "false");
shouldBe("new MediaEncryptedEvent('eventType').cancelable", "false");
shouldBeEqualToString("new MediaEncryptedEvent('eventType').initDataType", "");
shouldBeNull("new MediaEncryptedEvent('eventType').initData");

// Bubbles and cancelable true, others are missing.
shouldBe("new MediaEncryptedEvent('eventType', { bubbles: true, cancelable: true }).bubbles", "true");
shouldBe("new MediaEncryptedEvent('eventType', { bubbles: true, cancelable: true }).cancelable", "true");
shouldBeEqualToString("new MediaEncryptedEvent('eventType', { bubbles: true, cancelable: true }).initDataType", "");
shouldBeNull("new MediaEncryptedEvent('eventType', { bubbles: true, cancelable: true }).initData");

// initDataType is passed.
shouldBeEqualToString("new MediaEncryptedEvent('eventType', { initDataType: 'foo' }).initDataType", "foo");

// initData is passed.
var initData = new ArrayBuffer(1);
shouldBe("new MediaEncryptedEvent('eventType', { initData: initData }).initData", "initData");
shouldThrow("new MediaEncryptedEvent('eventType', { initData: 'foo' }).initData");
shouldThrow("new MediaEncryptedEvent('eventType', { initData: 1 }).initData");

</script>
</body>
</html>
